﻿package mortal.game.resource.tableConfig
{
    import Message.DB.Tables.*;
    import com.gengine.resource.*;
    import flash.utils.*;
    import mortal.game.utils.*;

    public class DescConfig extends Object
    {
        private var _map:Dictionary;
        private static var _instance:DescConfig;

        public function DescConfig()
        {
            this._map = new Dictionary();
            if (_instance != null)
            {
                throw new Error(" DelegateConfig 单例 ");
            }
            this.init();
            return;
        }// end function

        private function init() : void
        {
            var _loc_1:* = ConfigManager.instance.getJSONByFileName("t_desc.json");
            this.write(_loc_1);
            return;
        }// end function

        private function write(param1:Object) : void
        {
            var _loc_2:TDesc = null;
            var _loc_3:Object = null;
            for each (_loc_3 in param1)
            {
                
                _loc_2 = new TDesc();
                _loc_2.code = _loc_3.code;
                _loc_2.desc = _loc_3.desc;
                this._map[_loc_2.code] = _loc_2;
            }
            return;
        }// end function

        public function getDescById(param1:int) : String
        {
            if (!this._map.hasOwnProperty(param1))
            {
                return "";
            }
            return (this._map[param1] as TDesc).desc;
        }// end function

        public function getDescAlyzObj(param1:int, param2:Object) : String
        {
            var _loc_3:* = this.getDescById(int(param1));
            return DescUtil.analyzeStr(_loc_3, param2);
        }// end function

        public static function get instance() : DescConfig
        {
            if (_instance == null)
            {
                _instance = new DescConfig;
            }
            return _instance;
        }// end function

    }
}
